home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 15 / macformat_15.iso / C de cerca / Codewarrior Lite / MacOS Support / Headers / ANSI Headers / stdexcept < prev    next >
Text File  |  1995-12-29  |  3KB  |  104 lines

  1. /************************************************************************/
  2. /*    Project...:    Standard C++ Library                                    */
  3. /*    Name......:    stdexcept                                                */
  4. /*    Purpose...:    exception handling                                        */
  5. /*  Copyright.: ©Copyright 1993-95 by metrowerks inc                    */
  6. /************************************************************************/
  7.  
  8. #ifndef _STDEXCEPT_
  9. #define _STDEXCEPT_
  10.  
  11. #ifdef __NOSTRING__
  12. class string;        //    we don't want to include <string>
  13. #else
  14. //#include <string>    //    this line cause a recursive include
  15. class string;        //    we don't want to include <string>
  16. #endif
  17.  
  18. #if __MWERKS__
  19. #pragma options align=mac68k
  20.  
  21. #if __CFM68K__ && __USING_IMPORTED_ANSI__
  22. #pragma import on
  23. #endif
  24. #endif
  25.  
  26. class exception;
  27. class logic_error;
  28. class domain_error;
  29. class invalid_argument;
  30. class length_error;
  31. class out_of_range;
  32. class runtime_error;
  33. class range_error;
  34. class overflow_error;
  35.  
  36. class exception {
  37. public:
  38.     exception() {}
  39.     exception(const exception&) {}
  40.     exception& operator=(const exception&) throw() { return *this; }
  41. //    virtual ~exception() throw();
  42.     virtual const char* what() const /*throw()*/;
  43. };
  44.  
  45. class logic_error : public exception {
  46.     const string&    mwhat;
  47. public:
  48.     logic_error(const string& what_arg) : mwhat(what_arg) {}
  49.     virtual const char* what() const;
  50. };
  51.  
  52. class domain_error : public logic_error {
  53. public:
  54.     domain_error(const string& what_arg) : logic_error(what_arg) {}
  55.     virtual const char* what() const;
  56. };
  57.  
  58. class invalid_argument : public logic_error {
  59. public:
  60.     invalid_argument(const string& what_arg) : logic_error(what_arg) {}
  61.     virtual const char* what() const;
  62. };
  63.  
  64. class length_error : public logic_error {
  65. public:
  66.     length_error(const string& what_arg) : logic_error(what_arg) {}
  67.     virtual const char* what() const;
  68. };
  69.  
  70. class out_of_range : public logic_error {
  71. public:
  72.     out_of_range(const string& what_arg) : logic_error(what_arg) {}
  73.     virtual const char* what() const;
  74. };
  75.  
  76. class runtime_error : public exception {
  77.     const string&    mwhat;
  78. public:
  79.     runtime_error(const string& what_arg) : mwhat(what_arg) {}
  80.     virtual const char* what() const;
  81. };
  82.  
  83. class range_error : public runtime_error {
  84. public:
  85.     range_error(const string& what_arg) : runtime_error(what_arg) {}
  86.     virtual const char* what() const;
  87. };
  88.  
  89. class overflow_error : public runtime_error {
  90. public:
  91.     overflow_error(const string& what_arg) : runtime_error(what_arg) {}
  92.     virtual const char* what() const;
  93. };
  94.  
  95. #if __MWERKS__
  96. #if __CFM68K__ && __USING_IMPORTED_ANSI__
  97. #pragma import reset
  98. #endif
  99.  
  100. #pragma options align=reset
  101. #endif
  102.  
  103. #endif
  104.